package com.ysd.lis.controller.cri;


import com.ysd.common.Result;
import com.ysd.lis.controller.pub.BaseController;
import com.ysd.lis.entity.cri.CriPost;
import com.ysd.lis.entity.cri.CriPostUser;
import com.ysd.lis.request.CriPostUserDto;
import com.ysd.lis.service.cri.CriPostService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 岗位表 前端控制器
 * </p>
 *
 * @author wh
 * @since 2025-02-10
 */
@RestController
@RequestMapping("/lis/cri/post")
public class CriPostController extends BaseController {

    @Autowired
    private CriPostService sysPostService;


    @ApiOperation("获取岗位信息")
    @GetMapping("/findPostList")
    public Result findPostList(String keywords) {
        return sysPostService.findPostList(keywords);
    }

    @ApiOperation("新增或修改岗位信息")
    @PostMapping("/saveOrUpdatePost")
    public Result saveOrUpdatePost(@RequestBody CriPost sysPost) {
        return sysPostService.saveOrUpdatePost(sysPost);
    }
    @ApiOperation("删除岗位信息")
    @PostMapping("/deletePostList")
    public Result deletePostList(@RequestBody List<CriPost> sysPost) {
        return sysPostService.deletePostList(sysPost);
    }
    @ApiOperation("根据岗位获取用户信息")
    @GetMapping("/findUserCompareByPost")
    public Result findUserCompareByPost(String postNo) {
        return sysPostService.findUserCompareByPost(postNo);
    }
    @ApiOperation("批次新增岗位用户中间表信息")
    @PostMapping("/saveBatchPostUser")
    public Result saveBatchPostUser(@RequestBody List<CriPostUser> sysPost) {
        return sysPostService.saveBatchPostUser(sysPost);
    }

    @ApiOperation("批次删除岗位用户中间表信息")
    @PostMapping("/batchDeletePostUserList")
    public Result batchDeletePostUserList(@RequestBody CriPostUserDto sysPostUserDto) {
        return sysPostService.batchDeletePostUserList(sysPostUserDto);
    }
}
